#include "calculator.h"

/**
 * @brief Construct a new Calculator:: Calculator object
 * 实现一个使用C++编写的计算器
 */
Calculator::Calculator() {}

int Calculator::add(int a, int b) {
    return a + b;
}

int Calculator::subtract(int a, int b) {
    return a - b;
}

int Calculator::multiply(int a, int b) {
    return a * b;
}

float Calculator::divide(int a, int b) {
    if (b == 0) {
        throw "Division by zero error!";
    }
    return static_cast<float>(a) / b;
}